package exam.demo3;
import java.util.Scanner;

public class Test1 {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            String str = in.next();

            int s = 0;
            int h = 0;
            int y = 0;
            for(int i = 0; i < n; i++) {
                if(str.charAt(i) == 's') {
                    s++;
                }
                if(str.charAt(i) == 'h') {
                    h++;
                }
                if(str.charAt(i) == 'y') {
                    y++;
                }
            }
            int sum = s*y*h;
            System.out.println(sum);
        }
}
